|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectcontrolP5.Controller
controlP5.Matrix
public class Matrix
a matrix is a 2d array with one pointer that traverses through the matrix with a timed interval. if an item of a matrix-column is active, the x and y position of the corresponding cell will trigger an event. see the example for more information. TODO add multi-cells access to the vertical axis
/**
* ControlP5 Matrix
* click into the blue box, the matrix, to activate and deactivate
* cells of the matrix. A matrix can be used for example
* a sequencer, a drum machine.
*
* by andreas schlegel, 2009
*/
import controlP5.*;
ControlP5 controlP5;
int myColorBackground = color(0,0,0);
void setup() {
size(600,400);
frameRate(30);
controlP5 = new ControlP5(this);
controlP5.addMatrix("someMatrix", 20, 20, 10, 10, 400, 300);
}
void draw() {
background(myColorBackground);
}
void keyPressed() {
controlP5.controller("someMatrix").setValue(256);
}
void controlEvent(ControlEvent theEvent) {
println("## controlEvent / id:"+theEvent.controller().id()+"\n"+
"name:"+theEvent.controller().name()+"\n"+
"label:"+theEvent.controller().label()+"\n"+
"value:"+theEvent.controller().value()+"\n"+
"matrixValue x:"+Matrix.getX(theEvent.controller().value())+"\n"+
"matrixValue y:"+Matrix.getY(theEvent.controller().value())+"\n"
);
}
| Field Summary |
|---|
| Fields inherited from interface controlP5.ControlP5Constants |
|---|
acceptClassList, ACTIVE, ALT, ARC, ARRAY, BACKSPACE, BOOLEAN, BOTTOM, CENTER, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IMAGE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LINE, LOAD, MENU, METHOD, MOVE, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, SAVE, SHIFT, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TWO_PI, UP, VERBOSE, VERTICAL |
| Constructor Summary | |
|---|---|
Matrix(ControlP5 theControlP5,
ControllerGroup theParent,
java.lang.String theName,
int theCellX,
int theCellY,
int theX,
int theY,
int theWidth,
int theHeight)
|
|
| Method Summary | |
|---|---|
void |
addToXMLElement(ControlP5XMLElement theElement)
|
int |
getInterval()
|
static int |
getX(float thePosition)
|
static int |
getX(int thePosition)
|
static int |
getY(float thePosition)
|
static int |
getY(int thePosition)
|
void |
mousePressed()
|
void |
mouseReleased()
|
void |
set(int theX,
int theY,
boolean theValue)
set the state of a particular cell in a matrix. |
void |
setInterval(int theInterval)
set the speed of intervals in millis iterating through the matrix. |
void |
setValue(float theValue)
set the value of the controller. |
void |
update()
updates the value of the controller without having to set the value explicitly. |
void |
updateDisplayMode(int theMode)
|
void |
updateInternalEvents(processing.core.PApplet theApplet)
TODO |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Matrix(ControlP5 theControlP5,
ControllerGroup theParent,
java.lang.String theName,
int theCellX,
int theCellY,
int theX,
int theY,
int theWidth,
int theHeight)
| Method Detail |
|---|
public void setInterval(int theInterval)
theInterval - intpublic int getInterval()
public void updateInternalEvents(processing.core.PApplet theApplet)
Controller
updateInternalEvents in interface ControllerInterfaceupdateInternalEvents in class ControllerControllerInterfalce.updateInternalEventspublic void mousePressed()
public void mouseReleased()
public void setValue(float theValue)
Controller
setValue in class ControllertheValue - floatpublic void update()
Controller
update in interface ControllerInterfaceupdate in class Controller
public void set(int theX,
int theY,
boolean theValue)
theX - theY - theValue - public static int getX(int thePosition)
public static int getY(int thePosition)
public static int getX(float thePosition)
public static int getY(float thePosition)
public void addToXMLElement(ControlP5XMLElement theElement)
theElement - ControlP5XMLElementpublic void updateDisplayMode(int theMode)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||